<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>

<html>
	<head>
		<title>IdeaPad - View Members</title>
		<link rel="stylesheet" type="text/css" href="styles/main.css">
		<link rel="stylesheet" type="text/css" href="styles/buttons.css">
		<link rel="stylesheet" type="text/css" href="styles/currentbutton.css">
	</head>
	<body>
		<div class="header">
			<html:link action="/default">
				<img src="/IdeaPad/images/ideapad_logo.png" alt="logo" border="0" />
			</html:link>
			<%
				if (session.getAttribute("username") == null || session.getAttribute("username") == "") {
			%>
			<html:link page="/form/login.jsp" styleClass="menubuttons">Login</html:link>
			<html:link page="/form/registerUser.jsp" styleClass="menubuttons">Register</html:link>
			<%
				} else {
			%>
			Hello
			<%=session.getAttribute("username").toString()%>
			<html:link action="viewGroups" styleClass="currentbutton">Groups</html:link>
			<html:link action="manageGroups" styleClass="menubuttons">Manage Groups</html:link>
			<html:link page="/form/editUserSettings.jsp" styleClass="menubuttons">Settings</html:link>
			<html:link action="logout" styleClass="menubuttons">Logout</html:link>
			<%
				}
			%>
		</div>

		<logic:messagesPresent>
			<font color="red"> <logic:iterate name="Errors" id="Error"
					scope="request">
					<bean:write name="Error" />
					<br />
				</logic:iterate> </font>
		</logic:messagesPresent>

		<logic:notEmpty name="group">

			<h1>
				Group ID:
				<bean:write name="group" property="groupId" />
				<br />
				Group Name:
				<bean:write name="group" property="groupName" />
				<br />
				<br />

				<b>Moderators</b>
			</h1>

			<table border="1">
				<tr>
					<td>
						User ID
					</td>
					<td>
						Username
					</td>
				</tr>

				<logic:notEmpty name="moderators" scope="request">
					<logic:iterate name="moderators" id="moderator">
						<tr>
							<td>
								<bean:write name="moderator" property="userId" />
							</td>
							<td>
								<bean:write name="moderator" property="username" />
							</td>
						</tr>
					</logic:iterate>
				</logic:notEmpty>
			</table>

			<h1>
				Users
			</h1>

			<table border="1">
				<tr>
					<td>
						User ID
					</td>
					<td>
						Username
					</td>
				</tr>

				<logic:notEmpty name="users" scope="request">
					<logic:iterate name="users" id="userInGroup">
						<tr>
							<td>
								<bean:write name="userInGroup" property="userId" />
							</td>
							<td>
								<bean:write name="userInGroup" property="username" />
							</td>
						</tr>
					</logic:iterate>
				</logic:notEmpty>
			</table>
		</logic:notEmpty>
	</body>
</html>

